﻿using facebook.businuss.netcore.sdk.Enum;
using facebook.businuss.netcore.sdk.Extensions;
using facebook.businuss.netcore.sdk.Sdk;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net;

namespace facebook.businuss.netcore.sdk.console
{
    class Program
    {
        static void Main(string[] args)
        {


            GetAddCount();


            Console.WriteLine("Hello World!");
        }

        static void BMApi()
        {
            String access_token = "EAAQvHXSZB2ZC0BACuBZBx5IgEnrlruFcQ0ANQfQpy0ZA5bYZCqKGWKqKnuW1wZBkJCDVrUkHGBItAslAXZCcEVtVV0OlgErZCsyHrpP4kVcYCkA89QdongdflyxkuroTPgx6osz8Ng8ouDRTVk4AH21ZBjbJUvH1BP1RHlTKrugpM7WZCgMRbMagG2";
            String ad_account_id = "272976867526199";
            APIContext context = new APIContext(access_token, new WebProxy("127.0.0.1", 10809)).enableDebug(true);


            var x = (new ArrayList() { EnumBreakdowns.publisher_platform }).ToArray();
            //var result = new BMAccount(ad_account_id, context).GetBMAcount().execute();
        }

        static void AdAcountApi()
        {
            String access_token = "EAAqGxeXinm0BABLNpHZBnmCzF7UNeQdRemXSoPUxNCW9uuyVYnx7yXiEOt6potZCgeGBDBWPuJTUQxiJZBxPQTiMfPRwnUEaaymFB8KSbwRvZBsJ7s1gTZANYBZCTq6KpdgemsP9EKeCL8wvjCIjOwnLtHlBPq2M2ElCXXet9mm0rAbOu7cD8z";
            String ad_account_id = "980251099423457";
            APIContext context = new APIContext(access_token, new WebProxy("127.0.0.1", 10809)).enableDebug(true);


            var x = (new ArrayList() { EnumBreakdowns.publisher_platform }).ToArray();
            var result = new AdAccount(ad_account_id, context).getInsights()
                   //.setTimeRange("{\"since\":\"2021-07-20\",\"until\":\"2021-08-22\"}")
                   .setDatePreset(EnumDatePreset.yesterday)
                   .setFiltering("[]")
                   .setLevel(EnumLevel.account)
                   .setBreakdowns(new List<string>() { EnumBreakdowns.publisher_platform.ToString() }.ToArrayStr())
                  .requestField("ad_id")
                  .requestField("ad_name")
                  .requestField("spend")
                  .requestField("date_start")
                  .requestField("date_stop")
                  .requestField("account_id")
                  .requestField("account_name")
                  //.requestField("campaign_group_name")
                  //.requestField("campaign_group_id")
                  //.requestField("adgroup_name")
                  //.requestField("adgroup_id")
                  .requestField("campaign_id")
                  .requestField("campaign_name")
                   .execute();
        }

        static void GetAddCount()
        {
            String access_token = "EAAHmRjq9REEBABJZBmAvCTcUGZAxI3jbUfkfa3Y1yTKmhkrOwAuDSzlo4d4h1YhTa2QsxYxQHPI5NqrEYuwkX7uY6GnP6wo3UZBtvNuU2NwL4xZCbGGL3nY43KIl4QkOMOnupZB2ViBEtwAbYcMd4LSAZAcFRAeD3Q0wadOinR5wZDZD";
            String userid = "121710760215037";
            APIContext context = new APIContext(access_token, new WebProxy("127.0.0.1", 10809)).enableDebug(true);

            var result = new UserAccount(userid, context).GetAdAccount()
                  .requestField("id")
                  .requestField("account_id")
                  .requestField("account_status")
                   .execute();
        }
    }
}
